package com.xhd.pool;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import com.xhd.server.ServerConfig;

public class Resource {
	String RsStr;
	HashMap HtResources = new HashMap(4);

	protected boolean makeTexts(Map paramMap, String paramString1, String paramString2)
	  {
	    Iterator localIterator = paramMap.keySet().iterator();
	    String str1 = paramString1 + "_";
	    int i = str1.length();
	    for (int j = 0; localIterator.hasNext(); j = 1)
	    {
	      String str2 = (String)localIterator.next();
	      if ((str2.length() > i) && (str2.startsWith(str1)))
	      {
	        String str3 = str2.substring(i, str2.length());
	        if (this.HtResources.put(str3, paramMap.get(str2)) == null)
	        	return true;
	        //  break label154;
	       // j = 1;
	      //  break label154:
	      }
	     /* label154: if ((paramString2 == null) || (!(str2.equals(paramString1))) || (this.HtResources.put(paramString2, paramMap.get(str2)) == null))
	        break label154;*/
	    }
		return false;
	  
	  }
	
	public String getText(int paramInt) {
		String str1 = String.valueOf(paramInt);
		String str2 = (String) this.HtResources.get(str1);
		if ((str2 == null) || (paramInt != ServerConfig.DefaultLanguage)) {
			str1 = String.valueOf(ServerConfig.DefaultLanguage);
			str2 = (String) this.HtResources.get(str1);
		}
		return str2;
	}
	
	  public String getText(int paramInt, String paramString)
	  {
	    String str1 = String.valueOf(paramInt);
	    String str2 = (String)this.HtResources.get(str1);
	    if ((str2 == null) || (paramInt != ServerConfig.DefaultLanguage))
	    {
	      str1 = String.valueOf(ServerConfig.DefaultLanguage);
	      str2 = (String)this.HtResources.get(str1);
	    }
	    if (str2 != null)
	    {
	      MessageFormat localMessageFormat = new MessageFormat(str2);
	      str2 = localMessageFormat.format(new String[] { paramString });
	    }
	    return str2;
	  }

	  public String getText(int paramInt, String[] paramArrayOfString)
	  {
	    String str1 = String.valueOf(paramInt);
	    String str2 = (String)this.HtResources.get(str1);
	    if ((str2 == null) && (paramInt != ServerConfig.DefaultLanguage))
	    {
	      str1 = String.valueOf(ServerConfig.DefaultLanguage);
	      str2 = (String)this.HtResources.get(str1);
	    }
	    if (str2 != null)
	    {
	      MessageFormat localMessageFormat = new MessageFormat(str2);
	      str2 = localMessageFormat.format(paramArrayOfString);
	    }
	    return str2;
	  }

}
